﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public unsafe class Console : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    
    internal static void WriteLine(sbyte * v)
    {
        print(new string(v));
    }

    internal static void WriteLine(string v,long i=0)
    {
        print(v);
    }

    internal static void Write(string v)
    {
        print(v);
    }

    internal static void Write(sbyte * v)
    {
        print(new string ( v));
    }

    internal static void Write(string s, long v,void* p)
    {
        print(string.Format(s, v,(int)p));
    }

    internal static void Write(string v, object offset)
    {
        print(string.Format(v, offset));

    }

    internal static void Write(string v, int cODE_ADDRESS, int cODE_SIZE)
    {
        print(string .Format ( v,cODE_ADDRESS, cODE_SIZE));
    }

    internal static void Write(string v, object filename, object extName, uint ret)
    {
        print(string.Format(v, filename, extName,ret));
    }

    public static void Write(string info1, sbyte* info2 = null)
    {
        Debug.Log(string.Format(info1, *info2));
    }

    public static void Write(string info1, sbyte* info2 = null,uint v1=0,uint v2=0,uint v3=0,uint v4=0)
    {
        Debug.Log(string.Format(info1, *info2));
    }

    public static void Write(string info1,string info2 = null, uint v1 = 0, uint v2 = 0, uint v3 = 0, uint v4 = 0)
    {
        Debug.Log(string.Format(info1, info2,v1,v2,v3,v4));
    }

    public static void Write(string info1, object info2 = null, object info3 = null)
    {
        Debug.Log(string.Format(info1, info2, info3));
    }

    public static void Write(string info1, sbyte* info2 = null, sbyte* info3 = null, sbyte* info4 = null, sbyte* info5 = null)
    {
        Debug.Log(string.Format(info1, *info2, *info3, *info4, *info5));
    }

    public static void Write(string info1, object info2 = null, object info3 = null, object info4 = null, object info5 = null)
    {
        Debug.Log(string.Format(info1, info2, info3, info4, info5));
    }

    public static void Write(string info1, sbyte* info2 = null, object info3 = null)
    {
        Debug.Log(string.Format(info1, *info2, info3));
    }

    public static void Write(sbyte info1, object info2 = null, object info3 = null)
    {
        Debug.Log(string.Format("{0}: {1}", info1, info2));
    }

    internal static void Write(string v, uint addr, string filename, string ext, string entry)
    {
        Debug.Log(string.Format(v, addr, filename));
    }
}

public class Convert
{
    internal unsafe static int ToInt32(sbyte* v)
    {
        return *((int*)v);
    }
}
